package com.sakura.二分查找;

public class Code162_寻找峰值 {

    public int findPeakElement(int[] nums) {
        int left = -1;
        int right = nums.length -1;
        while (left + 1 < right) {
            int mid = (right + left) >>> 1;
            if (nums[mid] > nums[mid + 1]) {
                right = mid;
            } else {
                left = mid;
            }
        }
        return right;
    }
}
